package com.xlb.convert;

import com.xlb.domain.dos.WikiDO;
import com.xlb.model.vo.wiki.FindWikiPageListRspVO;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author 小聋包
 * @date 2024/6/4
 * @Version 1.0
 */
@Mapper
public interface WikiConvert {

    /**
     * 初始化 convert 实例
     */
    WikiConvert INSTANCE = Mappers.getMapper(WikiConvert.class);

    /**
     * WikiDO -> FindWikiPageListRspVO
     * @param bean
     * @return
     */
    @Mapping(target = "isTop", expression = "java(bean.getWeight() > 0)")
    FindWikiPageListRspVO convertDO2VO(WikiDO bean);
}
